package com.moore.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.moore.bean.CareerIntentions;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IntentionsMapper extends BaseMapper<CareerIntentions> {
    @Select("SELECT ci.*, i.industry_name, p.position_name " +
            "FROM career_intentions ci " +
            "LEFT JOIN industry i ON ci.expected_industry = i.industry_id " +
            "LEFT JOIN position p ON ci.expected_position = p.position_id " +
            "WHERE ci.candidate_id = #{userId}")
    List<CareerIntentions> selectCareerIntentionsWithDetails(@Param("userId") int userId);

    @Select("SELECT ci.*, i.industry_name, p.position_name " +
            "FROM career_intentions ci " +
            "LEFT JOIN industry i ON ci.expected_industry = i.industry_id " +
            "LEFT JOIN position p ON ci.expected_position = p.position_id " +
            "WHERE ci.intentions_id = #{id}")
    CareerIntentions getCareerIntentionsById(int id);
}
